﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Manage_Modle_CateGory_CateView : System.Web.UI.Page
{
    private Dcms.BLL.Dcms_CateBLL bdc = new Dcms.BLL.Dcms_CateBLL();
    private DataSet ds = new DataSet();
    string spane = "</td><td>";
    int co = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        Dcms.BLL.Dcms_CateBLL bdc = new Dcms.BLL.Dcms_CateBLL();
        ds = bdc.GetList("");
        Response.Write("<table>");
        Response.Write("<tr><td>分类名</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;语言版本</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;分类ID</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;分类标识</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;类别</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;显示样式</td></tr>");
        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            if (int.Parse(dr["Cate_ParentID"].ToString()) == 0)
            {
                co = 1 - co;
                if (co == 0)
                {
                    Response.Write("<tr style='background-color:#f1f1f1'>");
                }
                else
                {
                    Response.Write("<tr>");
                }

                
                 Response.Write("<td >" + dr["Cate_Name"].ToString() + spane + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + dr["Cate_Lang"].ToString() + spane+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"  + dr["Cate_ID"].ToString() + spane + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + dr["Cate_Key"].ToString() + spane + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + dr["Cate_Flag"].ToString() + spane + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + dr["Cate_OpType"].ToString() + "</td>");
              
                Response.Write("</tr>");
                Response.Write("<tr></tr>");
                Response.Write("<tr></tr>");
                forgetNode(int.Parse(dr["Cate_ID"].ToString()), "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;---");

            }
           
        }
        Response.Write("</table>");
      //  Response.End();
       

    }



    protected void forgetNode(int ParentID, string first)
    {
        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            if (int.Parse(dr["Cate_ParentID"].ToString()) == ParentID)
            {
                co = 1 - co;
                if (co == 0)
                {
                    Response.Write("<tr style='background-color:#f1f1f1'>");
                }
                else
                {
                    Response.Write("<tr>");
                }

                Response.Write("<td>" + first + dr["Cate_Name"].ToString() + spane + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + dr["Cate_Lang"].ToString() + spane + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + dr["Cate_ID"].ToString() + spane + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + dr["Cate_Key"].ToString() + spane + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + dr["Cate_Flag"].ToString() + spane + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + dr["Cate_OpType"].ToString() + "</td>");
               // Response.Write("<br><br>");
                Response.Write("</tr>");
                Response.Write("<tr></tr>");
                Response.Write("<tr></tr>");
                forgetNode(int.Parse(dr["Cate_ID"].ToString()), "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + first);
            }

        }
    }

    protected string getstr(string s,int count)
    {
        if (s.Length < count)
        {
            int ic = count - s.Length;
            for (int i = 0; i < ic; i++)
            {
                s += "&nbsp;";
            }
           
        }
        return s;
    }
}
